	<?php
		$id="";
		$name="";
		$urutan="";
		foreach($data->result() as $row){
			$id=$row->agama_id;
			$name=$row->agama;
			$urutan=$row->urutan;
		}
	?>

	<!-- BEGIN PAGE -->
	<div class="page-content">
         <!-- BEGIN PAGE CONTAINER-->        
         <div class="container-fluid">
            <!-- BEGIN PAGE HEADER-->
			<div class="row-fluid">
				<div class="span12"> 
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->			
					<h3 class="page-title">
						Form Agama <small> menambah dan mengedit agama</small>
					</h3>
					<ul class="breadcrumb">
						<li>
							<i class="icon-cogs"></i>
							Data Master		
							<i class="icon-angle-right"></i>
						</li>
						<li>
							<a href="<?php echo base_url()?>agama">Agama</a>		
							<i class="icon-angle-right"></i>
						</li>
						<li>Form Agama</li>	
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
            </div>
            <!-- END PAGE HEADER-->
            <!-- BEGIN PAGE CONTENT-->          
            <div class="row-fluid">
               <div class="span12">
                  <!-- BEGIN SAMPLE TABLE PORTLET-->
                  <div class="portlet box green">
                     <div class="portlet-title">
                        <div class="caption"><i class="icon-cogs"></i>Form Agama</div>
                     </div>
                     <div class="portlet-body form">
                        <form id="form-agama" class="form-horizontal form-bordered form-row-stripped" action="<?php echo base_url()."agama/form/".encode($id)?>" method="post">
							<div class="control-group">
								<label class="control-label" >Nama Agama:</label>
								<div class="controls">
									<input class="m-wrap span6" id="name" type="text" value="<?php echo $name?>" name="data[agama]" required />
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" >Urutan:</label>
								<div class="controls">
									<input class="m-wrap span6" id="urutan" type="digits" value="<?php echo $urutan?>" name="data[urutan]" required />
								</div>
							</div>
							<div class="form-actions">
							   <button type="submit" class="btn blue"><i class="icon-ok"></i> SIMPAN</button>
							   <a href="<?php echo base_url()?>agama" class="btn">BATAL</a>
							</div>
						</form>
                     </div>
                  </div>
                  <!-- END SAMPLE TABLE PORTLET-->
               </div>              
            </div>
           
            <!-- END PAGE CONTENT-->
         </div>
         <!-- END PAGE CONTAINER-->
    </div>
    <!-- END PAGE -->
	<script>
		$(document).ready(function(){
			$("#form-agama").validate(
				{
					errorElement: 'span', //default input error message container
					errorClass: 'help-inline', // default input error message class
					focusInvalid: false, // do not focus the last invalid input
					ignore: "",
					highlight: function (element) { // hightlight error inputs
						$(element)
							.closest('.help-inline').removeClass('ok'); // display OK icon
						$(element)
							.closest('.control-group').removeClass('success').addClass('error'); // set error class to the control group
					},

					unhighlight: function (element) { // revert the change dony by hightlight
						$(element)
							.closest('.control-group').removeClass('error'); // set error class to the control group
					},

					success: function (label) {
						label
							.addClass('valid').addClass('help-inline ok') // mark the current input as valid and display OK icon
						.closest('.control-group').removeClass('error').addClass('success'); // set success class to the control group
					}
				}
			);
			
			$('#type').select2({
	            placeholder: "Select an option",
	            allowClear: true
	        });
		});
	</script>